/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package presentation;

import java.awt.*;
import javax.swing.*;

/**
 *
 * @author Andreu Marimon
 */
public class GraficConf extends JPanel{
    PresentationController _pcontroller;
    ImageIcon _background;
    private static String _slash = System.getProperty("file.separator");
    private static String _path;

    public GraficConf(PresentationController pController){
//        String _jarPath = System.getProperty("java.class.path");
//        int _lastSlash = _jarPath.lastIndexOf(_slash);
//        _path = _jarPath.substring(0,_lastSlash + 1);

       String jarPath = System.getProperty("java.class.path");
       int lastDot = jarPath.lastIndexOf(";");
       String aux = jarPath;
       if (lastDot != -1) {
            aux = jarPath.substring(0, lastDot);
       }
       int lastSlash = aux.lastIndexOf(_slash);
       _path = aux.substring(0,lastSlash + 1);
       
        _pcontroller = pController;
        _background = new ImageIcon(_path+"imatges"+_slash+"background.jpg")  ;
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        this.setOpaque(true);
        g.drawImage(_background.getImage(), 0, 0, 800, 600, null );
    }
}
